<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>菱形</title>
    <style type="text/css">
        table {
            width: 800px;
            height: 300px;
            border-collapse: collapse;
        }
        table th {
            border: 1px solid #069;
        }
        body {
            /*text-align: center;*/
        }
        h1 {
            font-family: "微软雅黑", Verdana, sans-serif, "宋体";
            color: #666;
            font-weight: bold;
            margin-bottom: 30px;
        }
    </style>

</head>
<body>
<script language="javascript" type="text/javascript">
    function sanjiao(){
//        var num=window.prompt("请输入一个值"); num=parseInt(num);
        var num=16; num=parseInt(num);
        for(var i=0;i<num-1;i++){//这里-1表示循环次数减一
            for(var j=0;j<num-i-1;j++){
                document.writeln("&nbsp");
            }
            for(var k=0;k<2*i+1;k++)
            {
                document.writeln("*"+"&nbsp");
            }
            document.writeln("<br>");
        }
        for(var i=num;i>0;i--)  {
            for(var k=0;k<num-i;k++){
                document.writeln("&nbsp");}
            for(var j=2*i-1;j>0;j--){
                document.writeln("*"+"&nbsp");}
            document.writeln("<br>");  }
    }
//    sanjiao();
    function chengfabiao() {
        document.write("<table>");
        var str = "js九九乘法表";
        document.write("<h1>" + str + "</h1>");
        for ( var x = 1; x <= 9; x++) {
            document.write("<tr>");
            for ( var y = 1; y <= x; y++) {
                document.write("<th>" + x + "*" + y + "=" + (x * y) + "</th>");
            }
            document.write("</tr>");
        }
        document.write("</table>");

    }
//    chengfabiao();
    function whilechengfa() {

        var i=1;
        while(i<=9)//决定行数
        {
            var j=1;
            while(j<=i) //决定每一行有几个式子
            {
                document.write(j+"*"+i+"="+(i*j)+"\n");
                j++;
            }
            i++;
            document.write("<br>");
        }
    }
    whilechengfa();
    function tixin(){
        for ( var i = 0; i < 7; i++)
        {
            for ( var j = 0; j < 6 - i; j++)
            {
                document.write("&nbsp");
            }
            for ( var j = 0; j < 6 + 2 * i; j++)
            {
                document.write("*"+"&nbsp");
            }
            document.write("<br / >");
        }
    }
    tixin();
</script>

</body>
</html>